import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { ColorConfig } from "../../../resource/ColorConfig";
import { BaseItem } from "../../common/BaseItem";
import { OpenRechargeGiftBagConfig } from "../../../resource/OpenRechargeGiftBagConfig";
import { Language } from "../../../../../extend/language/Language";
import { ItemData } from "../../../resource/info/ItemData";
type int = number;
//class FirstRechargeItem
    
    export  class FirstRechargeItem /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.init();
            mouseChildren = false;
            return;
        }

        public get itemCode(): int
        {
            return this._itemCode;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 90, 98, this, ImagesConst.RechargeBottom);
            ObjCreate.createBg(5, 0, 80, 22, this, ImagesConst.FightingStrgBg);
            ObjCreate.createBg(13, 25, 64, 64, this, ImagesConst.PackItemBg);
            var loc1=new GTextFormat("", 12, ColorConfig.instance.getItemColor(4).intColor, true, null, null, null, null, flash.text.TextFormatAlign.CENTER);
            this._nameTxt = ObjCreate.createTextField("", 0, 2, 90, 20, this, loc1);
            this._baseItem = new BaseItem();
            this._baseItem.move(15, 27);
            this._baseItem.setSize(60, 60);
            this._baseItem.isDragAble = false;
            this._baseItem.isDropAble = false;
            addChild(this._baseItem);
            return;
        }

        public updateData(arg1: int): void
        {
            var loc1=OpenRechargeGiftBagConfig.instance.getFinalInfoByCode(arg1, 1);
            this._itemCode = loc1.itemCode;
            if (arg1 != 2) 
            {
                if (arg1 == 7) 
                {
                    this._nameTxt.text = Language.getStringByParam(20151, "20000");
                }
            }
            else 
            {
                this._nameTxt.text = Language.getString(20150);
            }
            var loc2=new ItemData(loc1.itemCode);
            this._baseItem.itemData = loc2;
            return;
        }

        public setClickState(arg1: Boolean): void
        {
            if (this._gradientGlow == null) 
            {
                this._gradientGlow = new Object /* flash.filters.GradientGlowFilter */();
                this._gradientGlow.distance = 0;
                this._gradientGlow.angle = 45;
                this._gradientGlow.colors = [16777062, 16776960];
                this._gradientGlow.alphas = [0, 1];
                this._gradientGlow.ratios = [0, 255];
                this._gradientGlow.blurX = 5;
                this._gradientGlow.blurY = 5;
                this._gradientGlow.strength = 2;
                this._gradientGlow.quality = flash.filters.BitmapFilterQuality.HIGH;
                this._gradientGlow.type = flash.filters.BitmapFilterType.OUTER;
            }
            if (arg1 && this._gradientGlow) 
            {
                this.filters = [this._gradientGlow];
            }
            else 
            {
                this.filters = [];
            }
            return;
        }

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_itemCode: int;

        /* internal */ /* var */_gradientGlow: Object /* flash.filters.GradientGlowFilter */;
    }
